local bozhongchan = fk.CreateSkill {
    name = "bozhongchan",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
    ["bozhongchan"] = "众颤",
    [":bozhongchan"] = "锁定技，每轮开始时，你选择至多X名其他角色（X为你的体力值），获得这些角色点数最大的一张手牌。",
    ["#bozhongchan-choose"] = "众颤：选择至多%arg名角色，获得其点数最大的牌",
    ["$bozhongchan1"] = "今吾入京城，欲寻人而食。",
    ["$bozhongchan2"] = "天下事在我，我今为之，谁敢不从？",
}


bozhongchan:addEffect(fk.RoundStart, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(bozhongchan.name) and
            table.find(player.room:getOtherPlayers(player, false), function (p)
                return not p:isKongcheng()
            end)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local targets = table.filter(room:getOtherPlayers(player, false), function (p)
            return not p:isKongcheng()
        end)
        targets = room:askToChoosePlayers(player, {
            targets = targets,
            min_num = 1,
            max_num = player.hp,
            prompt = "#bozhongchan-choose:::" .. player.hp,
            skill_name = bozhongchan.name,
            cancelable = false,
        })
        room:sortByAction(targets)
        local cards = {}
        for _, to in ipairs(targets) do
            local ids = table.filter(to:getCardIds("h"), function (id)
                return table.every(to:getCardIds("h"), function (id2)
                    return Fk:getCardById(id).number >= Fk:getCardById(id2).number
                end)
            end)
            if #ids > 0 then
                table.insert(cards, table.random(ids))
            end
        end
        if #cards > 0 then
            room:moveCardTo(cards, Player.Hand, player, fk.ReasonPrey, bozhongchan.name, nil, false, player)
        end
    end,
})

-- 移除置民的标记和补牌相关所有代码
-- 仅保留获取手牌功能

return bozhongchan
